home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
xcmd
/
dxcmds34.sit
/
Dartmouth XCMD's 3.4.3
/
card_20423.txt
< prev
next >
Wrap
Text File
|
1990-04-17
|
4KB
|
197 lines
-- card: 20423 from stack: in.3
-- bmap block id: 20783
-- flags: 4000
-- background id: 7836
-- name: ChooserName
----- HyperTalk script -----
on opencard
global nextPos
hide card field "source"
set the scroll of card field "documentation" to 0
put 0 into nextPos
pass opencard
end opencard
on Install
get ChooseTargetStack()
InstallResource XFCN,ChooserName,it
end Install
-- part 3 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=76 top=298 right=320 bottom=176
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Try It
----- HyperTalk script -----
on mouseUp
get ChooserName()
answer "ChooserName is: "&it
end mouseUp
-- part 5 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=18 top=32 right=288 bottom=480
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Documentation
-- part 8 (field)
-- low flags: 81
-- high flags: 0007
-- rect: left=18 top=31 right=289 bottom=492
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: source
-- part 10 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=304 top=299 right=321 bottom=425
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Show C Source
----- HyperTalk script -----
on mouseUp
get the visible of card field "source"
set the visible of card field "source" to not it
if it is false then
set the name of me to "Hide C Source"
else
set the name of me to "Show C Source"
end if
end mouseUp
-- part contents for card part 5
----- text -----
ChooserName 1.0
Roger Brown
ChooserName is an XFCN that returns the currently stored choose name.
Syntax is: get ChooserName()
REVISION HISTORY
1.0 9/6/89 First public release.
-- part contents for card part 8
----- text -----
/* program ChooserName1.0d0.c */
/* XCMD version */
/* ChooserName is a HyperCard XFCN that simply returns the chooser name.
Syntax is:
get ChooserName()
To compile: create a project with this and MacTraps. Build as code resource type
XFCN named ChooserName.
/* globals */
#define CHOOSERID -16096 /* resource id of the chooser name 'STR ' resource */
#include "stddata_ctype.c"
#include "strings.c"
#include "HyperXCmd.h"
#include "XCmdGlue.inc.c"
#include "SetUpA4.h"
/* -------------------- CfromPstrHandle -------------------- */
/* copy P string in handle h into c string s */
CfromPstrHandle(s,h)
char *s;
Handle h;
{
int len,c;
len = (int)**h; /* get length in first byte */
for (c=0;c<len;c++) s[c] = *(*h+c+1); /* move bytes to string */
s[len] = 0; /* mark end of string */
}
/* -------------------- GetChooserName -------------------- */
/* get the chooser name */
GetChooserName(name)
char *name;
{
Handle sH;
sH = GetResource('STR ',CHOOSERID); /* it lives here */
if (sH==NULL) {
/* can't find one */
strcpy(name,"No Chooser Name.");
return;
}
else CfromPstrHandle(name,sH);
}
ResultIs(paramPtr,theResult)
XCmdBlockPtr paramPtr;
char *theResult;
{
long len;
Handle resultHandle;
len = 1+strlen(theResult);
resultHandle = NewHandle(len);
BlockMove(theResult,*resultHandle,len);
paramPtr->returnValue = resultHandle;
}
/* XCMD entry point */
pascal void main(paramPtr)
XCmdBlockPtr paramPtr;
{
Handle taskHandle;
Str255 temp;
RememberA0();
SetUpA4();
GetChooserName(temp);
ResultIs(paramPtr,temp);
RestoreA4();
return;
}